//
//  UIView+ViewController.swift
//  WeChat
//
//  Created by 梁迪 on 15/12/23.
//  Copyright © 2015年 梁迪. All rights reserved.
//

import UIKit


extension UIView{
    func navController() -> UINavigationController? {
    
    var next = nextResponder()
        
        repeat{
        if let nextObj = next as? UINavigationController{
            
            return nextObj
            }
            
            next = next?.nextResponder()
        
        }while (next != nil)
    
    return nil
    
    }
    
    
    
    
    
    
    
    
}

